# -*- coding: utf-8 -*-
"""
Web framework/Tornado Httpserver/test02.py
"""
import tornado.web
import asyncio
import tornado.process
from tornado.httpserver import HTTPServer
from tornado.netutil import bind_sockets


class IndexHandler(tornado.web.RequestHandler):
    def get(self):
        self.finish("This is get method.")


sockets = bind_sockets(8888)
tornado.process.fork_processes(0)


async def main():
    app = tornado.web.Application([
        (r"/", IndexHandler)
    ])
    server = HTTPServer(app)
    server.add_sockets(sockets)

    await asyncio.Event().wait()


if __name__ == '__main__':
    asyncio.run(main())
